package com.dangdang.binarytree;


import jdk.nashorn.internal.objects.annotations.Setter;


public class Node {

    public int getValue() {
        return value;
    }

    public void setValue(int value) {
        this.value = value;
    }

    public Node getLeft() {
        return left;
    }

    public void setLeft(Node left) {
        this.left = left;
    }

    public Node getRight() {
        return right;
    }

    public void setRight(Node right) {
        this.right = right;
    }

    private  int  value;

    private Node left;

    private Node right;


    public  static void  generate(Node tree){

        Node node1 = new Node();
        node1.setValue(1);


        Node node3 = new Node();
        node3.setValue(3);

        Node node2 = new Node();
        node2.setValue(2);
        node2.setLeft(node1);
        node2.setRight(node3);

        Node node5 = new Node();
        node5.setValue(5);

        Node node7 = new Node();
        node7.setValue(7);

        Node node6 = new Node();
        node6.setValue(6);
        node6.setLeft(node5);
        node6.setRight(node7);

        Node node4 = new Node();
        node4.setValue(4);
        node4.setLeft(node2);
        node4.setRight(node6);

        Node node9 = new Node();
        node9.setValue(9);


        Node node11 = new Node();
        node11.setValue(11);

        Node node10 = new Node();
        node10.setValue(10);
        node10.setLeft(node9);
        node10.setRight(node11);

        Node node13 = new Node();
        node13.setValue(13);


        Node node14 = new Node();
        node14.setValue(14);
        node14.setLeft(node13);


        Node node12 = new Node();
        node12.setValue(12);
        node12.setLeft(node10);
        node12.setRight(node14);


        tree.setValue(8);
        tree.setLeft(node4);
        tree.setRight(node12);


    }

}
